

export default class LArrayOpt
{
    static Attach<T>(org: Array<T>, target: Array<T>) {
        org.forEach(x => target.push(x));
    }
    //static Carry<T>(org: Array<T>, target: Array<T>) {
    //    target = [];
    //    org.forEach(x => target.push(x));
    //}
    static Clone<T>(org: Array<T>): Array<T> {
        let target = [];
        org.forEach(x => target.push(x));
        return target;
    }
    static Copy<T>(org: Array<T>, target: Array<T>, begin: number, end: number) {
        for (let i = begin; i < end; ++i) {
            target.push(org[i]);
        }
    }
    static Insert<T>(target: Array<T>, location: number, res: Array<T>) {//: Array<T> {
        let front: Array<T> = target.slice(0, location);
        let after: Array<T> = target.slice(location, target.length);
        let result = front.concat(res, after);
        target.splice(0, target.length);
        for (let i = 0; i < result.length; ++i) {
            target.push(result[i]);
        }
        //return result;
    }
}